package edu.iscas.appcheckclient.Adpater;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import edu.iscas.appcheckclient.fragment.ActionFragment;
import edu.iscas.appcheckclient.fragment.HttpResponseFragment;
import edu.iscas.appcheckclient.fragment.LocationFragment;
import edu.iscas.appcheckclient.model.actions.Request;

/**
 * Created by dell on 2016/1/12.
 */
public class TabsPagerAdapter extends FragmentPagerAdapter{

    protected Request request;

    public TabsPagerAdapter(FragmentManager fm, Request request) {
        super(fm);
        this.request = request;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position){
            case 0:
                Fragment actionFragment = new ActionFragment();
                Bundle bundle = new Bundle();
                bundle.putString("appName", request.getAppName());
                bundle.putString("packageName", request.getPackageName());
                actionFragment.setArguments(bundle);
                return actionFragment;
            case 1:
                return new HttpResponseFragment();
            case 2:
                return new LocationFragment();
        }
        return null;
    }

    @Override
    public int getCount() {
        return 3;
    }
}
